import Vue from 'vue'
import App from './App.vue'
import "heyui/themes/index.less";
import HeyUI from 'heyui';
import echarts from 'echarts'
import axios from 'axios';
import md5 from 'js-md5';
import VueRouter from 'vue-router';
import router from './router/router-config.js';
Vue.use(HeyUI);
Vue.use(VueRouter)
Vue.config.productionTip = false
Vue.prototype.$axios =axios;
Vue.prototype.$md5 =md5;
Vue.prototype.$echarts = echarts
axios.defaults.withCredentials = true

router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
  next()
})
const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
new Vue({
  render: h => h(App),
  router
}).$mount('#app')
